﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.WebPages;
using OPM.Models;
using OPM.Models.BaseModel;
using OPM.Library.Models;

namespace OPM.Class
{
    // Bll - when some 
    public class Wb
    {
        public static User GetUser(string userName, string password)
        {
            password = password ?? "";
            var token = WSO.GetToken(userName.Trim(),WSG.EncodeString(password),
                AuthenForm.S, Util.GetClientIp());

            if (token==null) return null;
            var profile = WSO.GetProfile(token); 

            return profile;
        }

        public static GetTokenResult GetToken(string userName, string password)
        {
            password = password ?? "";
            var token = WSO.GetToken(userName.Trim(), WSG.EncodeString(password),
                AuthenForm.S, Util.GetClientIp());
            return token;
        }
    }
}